package com.xblibo.xruth.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xblibo.xruth.common.BaseController;
import com.xblibo.xruth.entity.Module;
import com.xblibo.xruth.service.CompanyService;
import com.xblibo.xruth.service.ModuleService;


/**
 * @Title: CompanyController.java
 * @Package com.xblibo.xruth.controller
 * @Description TODO(添加描述)
 * @author xblibo
 * @date 2011-07-15 15:24:26
 * @version V1.0
 */

@Controller
public class CompanyController extends BaseController{

	@Resource(name="companyService")
	private CompanyService companyService;
	
	@Resource(name="moduleService")
	private ModuleService moduleService;

	@RequestMapping(value = "/company/list")
	public String list(){
		
		return "/company/company_list";
	}

	@RequestMapping(value = "/company/add")
	public String add(){
		
		return "/company/company_add";
	}

	@RequestMapping(value = "/company/modify")
	public String modify(){
		
		return "/company/company_modify";
	}

	@RequestMapping(value = "/company/detail")
	public String detail(){
		
		return "/company/company_detail";
	}

	@RequestMapping(value = "/company/function")
	public String function(HttpServletRequest request){
		List<Module> modules = moduleService.findAll();
		request.setAttribute("modules", modules);
		return "/company/company_function";
	}
	
	@RequestMapping(value = "/company/index")
	public String index(HttpServletRequest request){
		return "redirect:/company/add";
	}
}
